<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class IndexController extends AbstractActionController
{
	protected $ApplicationTable;
	
	public function init(){
		return $this->footerAction();
	}
	
    public function indexAction()
    {
    	//$this->footerAction();
    	//$footers = $this->getServiceLocator()->get('application/index/footer')->fetchAll();
    	
    	$this->layout('template/application');
    	//$this->layout()->setVariable('footer', $this->footerAction());
    	//$this->placeholder('foo')->footerAction();
    	//$this->placeholder('foo')->set("Some text for later");
        return new ViewModel(array(
             'albumss' => $this->getApplicationTable()->fetchAll(),
        	 'footers' =>'hfg'
         ));
        
    }
    
    public function getApplicationTable()
    {
    	if (!$this->ApplicationTable) {
    		$sm = $this->getServiceLocator();
    		$this->ApplicationTable = $sm->get('Application\Model\ApplicationTable');
    	}
    	return $this->ApplicationTable;
    }
    public function footerAction(){
    	//$this->layout('layout/footer');
    	//$this->getResponse()->setContent('layout disabled');
    	 return new ViewModel(array(
        	 'footers' => 'footer'
         ));
    	//return 'duoc roi ok';
    }
}
